using System;
using System.ServiceProcess;
using System.Windows.Forms;
using Microsoft.Office.Project.EPMSync.Service.SyncNow.Properties;
using Microsoft.Office.Project.EPMSync.Config.Library;

namespace Microsoft.Office.Project.EPMSync.Service.SyncNow
{
    class Program
    {
        [STAThread]
        static void Main()
        {
            try
            {
                ServiceController myService = new ServiceController("EPMSyncService");
                myService.ExecuteCommand((int)SimpleServiceCustomCommand.ExecuteSyncNow);
                RightAwareMessageBox.Show(Resources.SyncNowSent, Resources.RunNowTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                RightAwareMessageBox.Show(Resources.SyncNowFailed, Resources.RunNowTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
